*** Settings ***
Library           SeleniumLibrary
Library           String
Resource          ../常用变量.txt
Resource          ../基本配置.txt
Resource          ../浏览器变量.txt
Resource          采购目录.txt

*** Test Cases ***
采购品目添加-基础信息
    login
    sleep    5
    Capture Page Screenshot
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式
    ${remark}    Generate Random String    10
    采购目录-组织方式-政府集中采购
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    #在采购目录页面断言
    打开页面    ${pe_list}
    goto    ${pe_list}
    Page Should Contain    ${pe_name}

采购品目添加-封装
    [Documentation]    1、封装登陆
    [Setup]    login
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式
    ${remark}    Generate Random String    10
    采购目录-组织方式-政府集中采购
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-政府公开招标
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式-政府公开招标
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-自行采购
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择自行采购类型
    采购方式-政府公开招标
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-预选供应商
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式-预算供应商
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-邀请招标
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式-邀请招标
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-单一来源采购
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式-单一来源采购
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-竞争性谈判
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式-竞争性谈判
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-竞争性磋商
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式-竞争性磋商
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-协议定点采购
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式-协议定点采购
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-批量集中采购
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式-批量集中采购
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-询价采购
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式-询价采购
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-跟标采购
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式-跟标采购
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-延续合同采购
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式-延续合同采购
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购品目添加-测试
    [Documentation]    1、封装登陆
    [Setup]    login
    Comment    login
    Comment    sleep    5
    Comment    Capture Page Screenshot    test.png
    Comment    打开url    ${Procurement_item_url}
    打开页面    ${Procurement_item_url}
    capture page screenshot
    #获取窗口的title
    go to    ${Procurement_item_url}
    ${titles}    Get Window Titles
    Comment    ${title2}    Get List Items    ${titles}    1
    Comment    ${title1}    Get List Items    ${titles}    0
    log    ${titles}
    Comment    log    ${title2}
    Comment    select window    title=${title2}
    sleep    5
    Comment    select window    title=${title1}
    Comment    采购品目跳转
    ${id}    Generate Random String    10
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    Generate Random String    10
    输入采购名目名称    ${pe_name}
    选择政府采购类型
    采购方式-测试
    采购目录-组织方式-政府集中采购
    ${remark}    Generate Random String    10
    备注    ${remark}
    采购目录保存
    Capture Page Screenshot
    断言目录名称    ${pe_name}
    [Teardown]    close

采购目录修改-随机
    [Documentation]    用例说明
    ...    1、新增采购目录-选择的是政府采购，且新增排序必须是1--此处限制比较严格
    ...    2、修改该添加的采购目录中的采购目录编码和名称，其他默认没有修改
    [Setup]    login
    #添加采购目录
    add_pe
    #得到采购目录的url
    打开页面    ${pe_list}
    goto    ${pe_list}
    ${pe_mod_url}    获取新增采购目录的url
    log    ${pe_mod_url}
    #打开修改页面
    打开页面    ${pe_mod_url}
    goto    ${pe_mod_url}
    capture page screenshot
    #修改目录编码
    ${id}    evaluate    "".join(random.sample("0123456789",6))    random,string
    log    ${id}
    输入目录编码    ${id}
    ${pe_name}    generate random string    10
    输入采购名目名称    ${pe_name}
    log    ${pe_name}
    capture page screenshot
    采购目录保存
    #在采购目录页面断言
    打开页面    ${pe_list}
    goto    ${pe_list}
    Page Should Contain    ${pe_name}
    [Teardown]    close

采购目录删除
    [Documentation]    用例说明
    ...    1、新增采购目录-选择的是政府采购，且新增排序必须是1--此处限制比较严格
    ...    2、此处定位到第一个目录信息的删除地方，进行删除
    [Setup]    login
    #添加采购目录
    add_pe
    #进入list页面
    Comment    打开页面    ${pe_list}
    goto    ${pe_list}
    #删除
    删除操作-确定
    capture page screenshot
    [Teardown]    close

采购目录删除-取消
    [Documentation]    用例说明
    ...    1、新增采购目录-选择的是政府采购，且新增排序必须是1--此处限制比较严格
    ...    2、此处定位到第一个目录信息的删除地方，进行删除
    [Setup]    login
    #添加采购目录
    add_pe
    #进入list页面
    Comment    打开页面    ${pe_list}
    goto    ${pe_list}
    #删除
    删除操作-取消
    capture page screenshot
    [Teardown]    close

采购目录停用-确定
    [Documentation]    用例说明
    ...    1、新增采购目录-选择的是政府采购，且新增排序必须是1--此处限制比较严格
    ...    2、此处定位到第一个目录信息的删除地方，进行删除
    [Setup]    login
    #添加采购目录
    add_pe
    #进入list页面
    Comment    打开页面    ${pe_list}
    goto    ${pe_list}
    #停用
    capture page screenshot
    采购停用-确定
    capture page screenshot
    [Teardown]    close

采购目录停用-取消
    [Documentation]    用例说明
    ...    1、新增采购目录-选择的是政府采购，且新增排序必须是1--此处限制比较严格
    ...    2、此处定位到第一个目录信息的删除地方，进行删除
    [Setup]    login
    #添加采购目录
    add_pe
    #进入list页面
    Comment    打开页面    ${pe_list}
    goto    ${pe_list}
    #停用
    capture page screenshot
    采购停用-取消
    capture page screenshot
    [Teardown]    close

采购目录添加下级
    [Documentation]    用例说明
    ...    1、新增采购目录-选择的是政府采购，且新增排序必须是1--此处限制比较严格
    ...    2、新增固定采购目录添加下级
    [Setup]    login
    #添加采购目录-可以不用此步骤
    add_pe
    #进入添加子级的页面
    Comment    打开页面    ${pe_list}
    goto    ${pe_child_url}
    ${id}    evaluate    "".join(random.sample("0123456789",6))    random,string
    采购子级排序    ${id}
    ${pe_bm}    generate random string    10
    采购子级编码    ${pe_bm}
    ${pe_name}    generate random string    10
    采购子级名称    ${pe_name}
    采购子级采购类型-自行类型-select
    采购子级采购类型-政府公开招标
    ${remark}    generate random string    10
    采购子级备注    ${remark}
    采购子级保存
    capture page screenshot
    [Teardown]    close

采购目录添加下级-自行采购
    [Documentation]    用例说明
    ...    1、新增采购目录-选择的是政府采购，且新增排序必须是1--此处限制比较严格
    ...    2、新增固定采购目录添加下级
    [Setup]    login
    #添加采购目录-可以不用此步骤
    add_pe
    #进入添加子级的页面
    Comment    打开页面    ${pe_list}
    goto    ${pe_child_url}
    ${id}    evaluate    "".join(random.sample("0123456789",6))    random,string
    采购子级排序    ${id}
    ${pe_bm}    generate random string    10
    采购子级编码    ${pe_bm}
    ${pe_name}    generate random string    10
    采购子级名称    ${pe_name}
    采购子级采购类型-政府类型
    采购子级采购类型-政府公开招标
    ${remark}    generate random string    10
    采购子级备注    ${remark}
    采购子级保存
    capture page screenshot
    [Teardown]    close

采购目录添加下级-自行采购-select
    [Documentation]    用例说明
    ...    1、新增采购目录-选择的是政府采购，且新增排序必须是1--此处限制比较严格
    ...    2、新增固定采购目录添加下级
    [Setup]    login
    #添加采购目录-可以不用此步骤
    add_pe
    #进入添加子级的页面
    Comment    打开页面    ${pe_list}
    goto    ${pe_child_url}
    ${id}    evaluate    "".join(random.sample("0123456789",6))    random,string
    采购子级排序    ${id}
    ${pe_bm}    generate random string    10
    采购子级编码    ${pe_bm}
    ${pe_name}    generate random string    10
    采购子级名称    ${pe_name}
    采购子级采购类型-自行类型-select-2
    采购子级采购类型-政府公开招标
    ${remark}    generate random string    10
    采购子级备注    ${remark}
    采购子级保存
    capture page screenshot
    [Teardown]    close
